/**
 * 微信小程序专用Webpack配置
 * 使用更简单的策略：主要复制文件并进行最小限度的处理
 */
const path = require('path');
const CopyPlugin = require('copy-webpack-plugin');

module.exports = {
  mode: 'development',
  entry: './app.js', // 只是一个占位符
  output: {
    path: path.resolve(__dirname, 'dist'),
    filename: '[name].js'
  },
  plugins: [
    new CopyPlugin({
      patterns: [
        // 复制所有文件，不作任何处理
        {
          from: '**/*',
          to: './',
          globOptions: {
            ignore: [
              '**/node_modules/**',
              '**/dist/**',
              '**/.git/**',
              '**/webpack*.js',
              '**/package*.json',
              '**/.babelrc',
              '**/*.map'
            ]
          },
          noErrorOnMissing: true
        }
      ]
    })
  ]
};
